<?php

namespace IDock\Insurance\ACIC\Request\NonCar;

use Exception;
use IDock\Insurance\ACIC\Request\AllACICRequest;
use IDock\Insurance\ACIC\Response\NonCar\NonCarCollectionResponse;
use IDock\Insurance\ACIC\Response\UploadFileResponse;

class NonCarCollectionRequest extends AllACICRequest
{
    protected $code = 'N001';

    protected $response = NonCarCollectionResponse::class;

    protected $urlTip = '渠道代收保单确认';

    private $sendData = [];

    public $noCarApi = true;

    /**
     * @return array
     * @throws Exception
     */
    public function generate(): array
    {
        return  $this->sendData;
    }
    public function setOrderNo($orderNo)
    {
        $this->sendData['OrderNo'] = $orderNo;
    }

    public function setSendData(array $data)
    {
        $body = $data['Body'] ?? [];

        $YBPayType = $body['YBPayType'] ?? '';

        $this->sendData['PayInfo'] = [
            'PayType' => $YBPayType == '1'? '1002' : '1004',//支付方式
            'PaySerialNo' => $body['AppOrderNo'] ?? '',
            'PayTime' => $body['PayTime'] ?? '',
            'PayAmount' => $body['NVhlAmt'] ?? '',
            'ActPayAmount' => $body['NVhlAmt'] ?? '',
            'YBPayType' => $YBPayType,
            'YBPaySerialNo' => $body['YBPaySerialNo'] ?? '',
        ];
    }

}
